<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
      py:extends="'master.kid'">
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" py:replace="''"/>
    <title>项目编辑 － TGSVN</title>
    <script language="JavaScript" type="text/javascript">
<!--
function fok(){
//提交
var su = document.getElementById('user');
var sm = document.getElementById('manager');
for (var i=0; i<su.options.length; i++)
su.options[i].selected=true;
for (var i=0; i<sm.options.length; i++)
sm.options[i].selected=true;
return true;}
function fadduser(){
//从所有用户中增加用户
var sau = document.getElementById('alluser');
var su = document.getElementById('user');
for (var i=0; i<sau.options.length; i++)
if(sau.options[i].selected){
try {su.add(sau.options[i], null); } catch(ex) { su.add(sau.options[i]);}
i=-1;}}
function fdeluser(){
//删除用户
var sau = document.getElementById('alluser');
var su = document.getElementById('user');
//var sm = document.getElementById('manager');
for (var i=0; i<su.options.length; i++)
if(su.options[i].selected){
//for(var f=0;f<sm.options.length; f++)
//if (su.options[i].value==sm.options[f].value)sm.remove(f);
try {sau.add(su.options[i], null); } catch(ex) { sau.add(su.options[i]);}
i=-1;}}
--> </script>
  </head>
  <body>
    <form method="post" action="setproject">
      <table>
	<tr>
          <th colspan="2" rowspan="1">编辑项目</th>
	</tr>
	<tr>
          <td>项目代码</td>
          <td><input name="code" value="${code}"/></td>
	</tr>
	<tr>
	  <td>项目名称</td>
	  <td><input name="name" value="${name}"/></td>
	</tr>
	<tr>
	  <td>项目介绍</td>
	  <td><input name="note" value="${note}"/></td>
	</tr>
	<tr>
	  <td>用户权限</td>
	  <td>
	    <select name="auth">
	      <option value="write" 
		      selected="${auth == 'write' and 'selected' or None}">读写</option>
	      <option value="read" 
		      selected="${auth == 'read' and 'selected' or None}">只读</option>
	      <option value="none" 
		      selected="${auth == 'none' and 'selected' or None}">禁用</option>
	    </select>
	  </td>
	</tr>
	<tr>
	  <td>来宾权限</td>
	  <td>
	    <select name="anon">
	      <option value="write" 
		      selected="${anon == 'write' and 'selected' or None}" >读写</option>
	      <option value="read" 
		      selected="${anon == 'read' and 'selected' or None}">只读</option>
	      <option value="none" 
		      selected="${anon == 'none' and 'selected' or None}">禁用</option>
	    </select>
	  </td>
	</tr>
	<tr colspan="2" rowspan="1">
          <td><input value="修改" type="submit" /></td>
	</tr>
      </table>
    </form>
    <form onsubmit="fok()" method="post" action="setusers" name="f2">
      <input name="code" value="${code}" type="hidden" />
      <table>
	<tr>
          <th colspan="3" rowspan="1">项目用户设置</th>
	</tr>
	<tr>
          <td>其他用户</td>
          <td>操作</td>
          <td>本项目用户</td>
	</tr>
	<tr>
	  <td>
	    <select name="alluser" multiple="true" size="5" id="alluser">
	      <option py:for="user in users" py:attrs="value=user.user_name" 
		      py:content="user.display_name.encode('utf-8')">剩余用户</option>
	    </select>
          </td>
          <td><input name="adduser" value="增加-&gt;" onclick="fadduser();" type="button" /><br />
	    <input name="deluser" value="&lt;-删除" onclick="fdeluser();" type="button" /></td>
          <td>
	    <select name="user" multiple="true" size="5" id="user">
	      <option py:for="user in nusers" py:attrs="value=user.user_name" 
		      py:content="user.display_name.encode('utf-8')">当前用户</option>
	    </select>
          </td>	      
	</tr>
	<tr>
          <td colspan="5" rowspan="1"><input value="修改" type="submit" /></td>
	</tr>
      </table>
    </form>
  </body>
</html>
